home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / pibt3sp1.arc / CLEARWIN.PAS < prev    next >
Pascal/Delphi Source File  |  1985-06-30  |  3KB  |  57 lines

  1. (*----------------------------------------------------------------------*)
  2. (*               Clear_Window --- Clear out lines in window             *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Clear_Window;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Clear_Window                                         *)
  10. (*                                                                      *)
  11. (*     Purpose:    Clears screen for current window                     *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Clear_Window                                                  *)
  16. (*                                                                      *)
  17. (*     Calls:   Upper_Left                                              *)
  18. (*              GoToXY                                                  *)
  19. (*              ClrEol                                                  *)
  20. (*                                                                      *)
  21. (*     Remarks:                                                         *)
  22. (*                                                                      *)
  23. (*       This routine exists because of a bug in the ClrScr routine     *)
  24. (*       when used with windows on a mono monitor with overlays:  the   *)
  25. (*       entire screen, not just the current window, is (incorrectly)   *)
  26. (*       cleared.  There may be other circumstances in which ClrScr     *)
  27. (*       will fail.                                                     *)
  28. (*                                                                      *)
  29. (*----------------------------------------------------------------------*)
  30.  
  31. VAR
  32.    Ytop: INTEGER;
  33.    Xtop: INTEGER;
  34.    Ybot: INTEGER;
  35.    I   : INTEGER;
  36.  
  37. BEGIN (* Clear_Window *)
  38.  
  39.                    (*---------------------------------------*)
  40.                    (*   If you have a color monitor, try    *)
  41.                    (*   replacing the remaining code with   *)
  42.                    (*   just ClrScr.  If it works, use it!  *)
  43.                    (*---------------------------------------*)
  44.  
  45.    Upper_Left( Xtop, Ytop );
  46.    Ybot := Lower_Right_Row;
  47.  
  48.    FOR I := 1 TO ( Ybot - Ytop + 1 ) DO
  49.       BEGIN
  50.          GoToXY( 1 , I );
  51.          ClrEol;
  52.       END;
  53.  
  54.    GoToXY( 1 , 1 );
  55.  
  56. END   (* Clear_Window *);
  57.